package com.mia.props.client.container.guilib;

public class GuiLabel extends GuiElement implements IGuiRenderable {
   private String text;
   private TextAlign alignment;
   private int color;

   public GuiLabel(IExposedGui parent, int x, int y, String text, TextAlign alignment, int color) {
      super(parent, x, y, 0, 10);
      this.text = text;
      this.alignment = alignment;
      this.color = color;
   }

   public String getText() {
      return this.text;
   }

   public void setText(String text) {
      this.text = text;
      if (this.parent.getFontRenderer() != null) {
         this.width_element = this.parent.getFontRenderer().getStringWidth(text);
      }

   }

   public TextAlign getAlignment() {
      return this.alignment;
   }

   public void setAlignment(TextAlign alignment) {
      this.alignment = alignment;
   }

   public int getColor() {
      return this.color;
   }

   public void setColor(int color) {
      this.color = color;
   }

   public void render(int mouseX, int mouseY) {
      if (this.width_element == 0) {
         this.width_element = this.parent.getFontRenderer().getStringWidth(this.text);
      }

      this.drawGuiAlignedString(this.text, this.posX, this.posY, this.alignment, this.color);
   }
}
